// 使用类的举例
class Greeter {
  // 类的属性
  greeting: string
  // 类的构造函数，new 的时候回调用它
  constructor (message: string) {
    this.greeting = message
  }
  // 类的方法
  greet () {
    return 'Helllo, ' + this.greeting
  }
}
let greeter = new Greeter('world')
console.log(greeter) // reeter { greeting: 'world' }

// 写一个最基本的继承
class Animal {
  move (distance: number): void {
    console.log(`Animal moved ${distance}`)
  }
}
class Dog extends Animal {
  bark () {
    console.log('wolf! wolf')
  }
}
const dog = new Dog()
dog.bark()
dog.move(10)
dog.bark()

